﻿/***********************************************************************
 * <copyright file="SqlServerGroupMenuDescriptionDao.cs" company="VidaGIS">
 * -->    Copyright (C) statement. All right reserved
 * </copyright>
 * 
 * Created:   Hoang Bich Son 
 * Email:    sonhb@vidagis.com or bichson2002@gmail.com
 * Website:
 * Create Date: Wednesday, November 26, 2014
 * Usage: 
 * 
 * RevisionHistory: 
 * Date         Author               Description 
 * 
 * ************************************************************************/

using System;
using System.Collections.Generic;
using System.Data;
using BusinessCMS;
using DataCMS.Interfaces;
using DataObjects;
using DataObjects.ADO;

namespace DataCMS.ADO.SqlServer
{
    /// <summary>
    /// SqlServerGroupMenuDescriptionDao class
    /// </summary>
    public class SqlServerGroupMenuDescriptionDao : IGroupMenuDescription
    {
        /// <summary>
        /// Gets the specified identifier.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public GroupMenuDescription Get(long id)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Gets the list by language identifier.
        /// </summary>
        /// <param name="languageId">The language identifier.</param>
        /// <returns></returns>
        public IList<GroupMenuDescription> GetListByLanguageId(short languageId)
        {
            const string sql = @"uspGroupMenuDescription_GetListByLanguageID";
            object[] parms = { "@LanguageID", languageId };
            return Db.ReadList(sql, CommandType.StoredProcedure, Make, parms);
        }

        /// <summary>
        /// Gets the pagging by language identifier.
        /// </summary>
        /// <param name="languageId">The language identifier.</param>
        /// <param name="currentPage">The current page.</param>
        /// <param name="totalRows">The total rows.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public IList<GroupMenuDescription> GetPaggingByLanguageId(short languageId, int currentPage, ref int totalRows)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Creates the specified group menu description.
        /// </summary>
        /// <param name="groupMenuDescription">The group menu description.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public object Create(GroupMenuDescription groupMenuDescription)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Updates the specified group menu description.
        /// </summary>
        /// <param name="groupMenuDescription">The group menu description.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public object Update(GroupMenuDescription groupMenuDescription)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Deletes the specified identifier.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public object Delete(long id)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Takes the specified group menu description.
        /// </summary>
        /// <param name="groupMenuDescription">The group menu description.</param>
        /// <returns></returns>
        private object[] Take(GroupMenuDescription groupMenuDescription)
        {
            return new object[]
             {
                 "@GroupMenuID",groupMenuDescription.GroupMenuId,
                 "@LanguageID",groupMenuDescription.LanguageId,
                 "@GroupMenuName",groupMenuDescription.GroupMenuName,
                 "@Description",groupMenuDescription.Description,
                 "@ModifiedDate",groupMenuDescription.ModifiedDate			
             };
        }

        /// <summary>
        /// The make
        /// </summary>
        private static Func<IDataReader, GroupMenuDescription> Make = reader =>
            new GroupMenuDescription
            {
                GroupMenuId = reader["GroupMenuID"].AsId(),
                LanguageId = reader["LanguageID"].AsShort(),
                GroupMenuName = reader["GroupMenuName"].AsString(),
                Description = reader["Description"].AsString(),
                ModifiedDate = reader["ModifiedDate"].AsDateTime()
            };
    }
}
